var gulp = require( 'gulp' );
var gutil = require( 'gulp-util' );
var ftp = require( 'vinyl-ftp' );

var conn = ftp.create( {
    host: "116.10.184.230",
    user: "tv_ailipai",
    password: "m57aJk3BfYwfkfNy",
    parallel: 10,
    maxConnections:10,
    idleTimeout:30*1000,
    log:myLogger
} );

function myLogger(a,b,c,d){
    console.log(a,b,c,d)
}

let pipe = gulp.src( [ 'D:\\ff_test\\out\\1_copy\\1080p\\**' ], { buffer: false } )
    .pipe( conn.dest( '/tv/368/1/1080p/' ) );


pipe.on("prefinish",function (a,b,c) {
    console.log("prefinish",a,b,c);
})

pipe.on("end",function (a,b,c) {
    console.log("end",a,b,c);
})

pipe.on("unpipe",function (pipe) {
    console.log("unpipe");
})
pipe.on("close",function (a,b,c) {
    console.log("close",a,b,c);
})
pipe.on("error",function (a,b,c) {
    console.log("error",a,b,c);
})
pipe.on("finish",function (a,b,c) {
    console.log("finish",a,b,c);
})
